package main

import (
	"app2word/controller"
	_ "app2word/utils"
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"github.com/unidoc/unioffice/common/license"
	_ "github.com/unidoc/unioffice/document"
)

func init() {
	key := "ecf52ad4ba72091dc2f3a6feff79d37a0d55fa172af5e8e4e970c15d29446082"
	err := license.SetMeteredKey(key)
	if err != nil {
		panic(err)
	}

}
func main() {
	engine := gin.Default()
	engine.Static("/public", "./public")
	InitRouter(engine)
	engine.Run("0.0.0.0:8282")
}

func InitRouter(router *gin.Engine) {
	config := cors.DefaultConfig()
	config.AllowAllOrigins = true
	router.Use(cors.New(config))
	router.POST("/files", controller.Files)
	router.POST("/export2Word", controller.Export2Word)
}
